<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 字符串模板</title>
</head>
<body>
<h2>变量替换</h2>
<p>模板字面量允许字符串中的变量：</p>

<p id="demo"></p>
<script>
  let firstName="Bill";
  let lastName="Gates";

  let text=`Welcome ${firstName},${lastName}!`;
  document.getElementById("demo").innerHTML=text;
</script>
</body>
</html>
<!--用真实值自动替换变量称为字符串插值。-->
<!--语法:${...}-->
<!--输出结果：Welcome Bill, Gates!-->